﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="user_list.aspx.cs" Inherits="Donal.Xms.Web.qianyi.common.user_list" ValidateRequest="false" %>

<%@ Import Namespace="Donal.Xms.Common" %>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <title>会员管理</title>
    <link rel="stylesheet" type="text/css" href="../../scripts/artdialog/ui-dialog.css" />
    <link rel="stylesheet" type="text/css" href="../../css/pagination.css" />
    <link rel="stylesheet" type="text/css" href="../skin/icon/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../skin/default/style.css" />
    <script type="text/javascript" src="../../scripts/jquery/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="../../scripts/artdialog/dialog-plus-min.js"></script>
    <script type="text/javascript" src="../../../scripts/datepicker/WdatePicker.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/laymain.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/common.js"></script>
    <script type="text/javascript">

        function showWaitDialog() {
            top.dialog({
                title: '确认提示',
                content: '这是双11活动短信的群发短信，请谨慎操作！，您确定要执行吗？',
                okValue: '确定',
                ok: function () {
                    var dialog = top.dialog({
                        id: 'waitingDialogId',
                        title: "请等待……",
                        url: 'dialog/dialog_waiting.aspx?titles=双11活动短信&ajax=3',
                        width: 300,
                        height: 100
                    }).showModal();
                },
                cancelValue: '取消',
                cancel: function () { }

            }).showModal();
        }


        $(function () {
            $(".toolbar").ruleLayoutToolbar();

            $("#btnImport").click(function () {
                showImportDialog();
            });

            function showImportDialog() {

                var dialog = top.dialog({
                    id: 'importDialogId',
                    title: "账号导入窗口",
                    url: 'dialog/dialog_Import.aspx?action=7',//可用
                    width: 900,
                    height: 600,
                    onclose: function () {
                    }
                }).showModal();

            }

            $("#btnExport").click(function () {
                dialog({
                    title: "账号导出",
                    content: "您确定要将会员账号导出吗？",
                    okValue: "确定",
                    ok: function () {

                        $.ajax({
                            type: "post",
                            url: "/tools/ExportExcel.ashx?action=exp_user_list_data_" + new Date().getTime(),
                            data: {
                                keywords: '<%= keywords%>',
                                status: '<%= status%>',
                                types: '<%= types%>',
                                start_time: '<%= start_time%>',
                                end_time: '<%= end_time%>'
                            },
                            dataType: "json",
                            success: function (data) {
                                if (data.status == 0) {
                                    top.dialog({
                                        id: 'DialogStatus',
                                        title: '提示',
                                        content: data.msg,
                                        okValue: '确定',
                                        ok: function () { }
                                    }).showModal(api);

                                } else {
                                    downLink(data.msg);
                                    return true;
                                }
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                top.dialog({
                                    title: '提示',
                                    content: '尝试发送失败，错误信息：' + errorThrown,
                                    okValue: '确定',
                                    ok: function () { }
                                }).showModal();
                            }

                        });
                    },
                    cancelValue: "取消",
                    cancel: function () { }
                }).showModal();
            });

            //链接下载
            function downLink(linkurl) {
                window.location.href = linkurl;
                return false;
            }

        });
    </script>
</head>

<body class="mainbody">
    <form id="form1" runat="server">
        <!--导航栏-->
        <div class="location">
            <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
            <a href="../center.aspx" class="home"><i class="iconfont icon-home"></i><span>首页</span></a>
            <i class="arrow iconfont icon-arrow-right"></i>
            <span>会员管理</span>
            <i class="arrow iconfont icon-arrow-right"></i>
            <span>所有账号</span>
        </div>
        <!--/导航栏-->

        <!--工具栏-->
        <div id="floatHead" class="toolbar-wrap">
            <div class="toolbar">
                <div class="box-wrap">
                    <a class="menu-btn"><i class="iconfont icon-more"></i></a>
                    <div class="l-list">
                        <ul class="icon-list">
                            <li><a href="user_edit.aspx?action=<%=DTEnums.ActionEnum.Add %>"><i class="iconfont icon-close"></i><span>新增</span></a></li>
                            <li style="display: none">
                                <a href="javascript:;" onclick="showWaitDialog();"><i class="iconfont icon-mail"></i><span>短信</span></a></li>
                            <li>
                                <a href="javascript:;" onclick="checkAll(this);"><i class="iconfont icon-check"></i><span>全选</span></a></li>
                            <li style="display: none">
                                <a style="cursor: pointer" id="btnImport"><i class="iconfont icon-exl"></i><span>导入</span></a></li>
                            <li>
                                <a style="cursor: pointer" id="btnExport"><i class="iconfont icon-exl"></i><span>导出</span></a></li>
                            <li>
                                <asp:LinkButton ID="btnDelete" runat="server" OnClientClick="return ExePostBack('btnDelete');" OnClick="btnDelete_Click"><i class="iconfont icon-delete"></i><span>删除</span></asp:LinkButton></li>
                        </ul>
                        <div class="menu-list">
                            <div class="rule-single-select">
                                <asp:DropDownList ID="ddlType" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlType_SelectedIndexChanged">
                                    <asp:ListItem Value=" ">所有类型</asp:ListItem>
                                    <asp:ListItem Value="3">超级用户</asp:ListItem>
                                    <asp:ListItem Value="2">管理员</asp:ListItem>
                                    <asp:ListItem Value="1">普通</asp:ListItem>
                                </asp:DropDownList>
                            </div>
                            <div class="rule-single-select">
                                <asp:DropDownList ID="ddlStatus" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlStatus_SelectedIndexChanged">
                                    <asp:ListItem Value=" ">所有状态</asp:ListItem>
                                    <asp:ListItem Value="1">正常</asp:ListItem>
                                    <asp:ListItem Value="2">禁用</asp:ListItem>
                                </asp:DropDownList>
                            </div>
                            <asp:TextBox ID="txtStartTime" runat="server" Width="120px" CssClass="input rule-date-input" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="添加时间"></asp:TextBox>
                            -
                            <asp:TextBox ID="txtEndTime" runat="server" Width="120px" CssClass="input rule-date-input" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="添加时间"></asp:TextBox>
                            <style>
                                .date-input {
                                    width: 120px;
                                }
                            </style>
                        </div>
                    </div>
                    <div class="r-list">
                        <asp:TextBox ID="txtKeywords" runat="server" CssClass="keyword" />
                        <asp:LinkButton ID="lbtnSearch" runat="server" CssClass="btn-search" OnClick="btnSearch_Click"><i class="iconfont icon-search"></i></asp:LinkButton>
                    </div>
                </div>
            </div>
        </div>
        <!--/工具栏-->

        <!--列表-->
        <div class="table-container">
            <asp:Repeater ID="rptList" runat="server">
                <HeaderTemplate>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable">
                        <tr>
                            <th width="5%">选择</th>
                            <th align="left" colspan="2">用户名</th>
                            <th width="10%">账号类型</th>
                            <th width="10%">手机</th>
                            <th width="10%">邮箱</th>
                            <th width="10%">微信</th>
                            <th width="10%">状态</th>
                            <th width="10%">最后登录时间</th>
                            <th width="5%">操作</th>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td align="center">
                            <asp:CheckBox ID="chkId" CssClass="checkall" runat="server" Style="vertical-align: middle;" />
                            <asp:HiddenField ID="hidId" Value='<%#Eval("id")%>' runat="server" />
                            <input name="hidMobile" type="hidden" value="<%#Eval("mobile")%>" />
                        </td>
                        <td width="64">
                            <a class="user-avatar" href="user_edit.aspx?action=<%#DTEnums.ActionEnum.Edit %>&id=<%#Eval("id")%>">
                                <%#Eval("avatar").ToString() != "" ? "<img width=\"64\" height=\"64\" src=\"" + Eval("avatar") + "\" />" : "<i class=\"iconfont icon-user-full\"></i>"%>
                            </a>
                        </td>
                        <td>
                            <div class="user-box">
                                <h4><b><%#Eval("user_name")%></b>（姓名：<%#Eval("nick_name")%>）</h4>
                                <i>公司：<%#Eval("companyName")%></i>
                            </div>
                        </td>
                        <td align="center"><%#Eval("group_id").ToString()=="1"?"管理员":Eval("group_id").ToString()=="2"?"超级用户":"普通"%></td>
                        <td align="center"><%#Eval("mobile")%></td>
                        <td align="center"><%#Eval("email")%></td>
                        <td align="center"><%#Eval("webchat")%></td>
                        <td align="center"><%#GetUserStatus(Convert.ToInt32(Eval("status")))%></td>
                        <td align="center"><%#new Donal.Xms.BLL.user_login_log().GetLastLoginTimeByUser(int.Parse(Eval("id").ToString()))%></td>
                        <td align="center"><a href="user_edit.aspx?action=<%#DTEnums.ActionEnum.Edit %>&id=<%#Eval("id")%>">修改</a></td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <%#rptList.Items.Count == 0 ? "<tr><td align=\"center\" colspan=\"9\">暂无记录</td></tr>" : ""%>
                </table>
                </FooterTemplate>
            </asp:Repeater>
        </div>
        <!--/列表-->

        <!--内容底部-->
        <div class="line20"></div>
        <div class="pagelist">
            <div class="l-btns">
                <span>显示</span><asp:TextBox ID="txtPageNum" runat="server" CssClass="pagenum" onkeydown="return checkNumber(event);"
                    OnTextChanged="txtPageNum_TextChanged" AutoPostBack="True"></asp:TextBox><span>条/页</span>
            </div>
            <div id="PageContent" runat="server" class="default"></div>
        </div>
        <!--/内容底部-->

    </form>
</body>
</html>
